import 'package:flutter/material.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBColor/YBColor.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBImageStyle/YBImageStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBHelper/YBTextStyle/YBTextStyle.dart';
import 'package:yb_zsyiji_androidflutter_pro/YBModule/YBLoginModule/YBLoginMainPage/YBLoginProvider/YBEventPassWordBus.dart';


class YBLoginPassWordTextField extends StatefulWidget {
  @override
  _YBLoginPassWordTextFieldState createState() => _YBLoginPassWordTextFieldState();
}

class _YBLoginPassWordTextFieldState extends State<YBLoginPassWordTextField> {

  TextEditingController _editingController = TextEditingController();

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    _editingController.addListener(() {
      pwdBus.fire(YBEventPassWordBus(pwdStr: _editingController.text));
    });
  }



  @override
  Widget build(BuildContext context) {
    return Container(
      height: YBTextStyle.adapterSize50,
      child: Column(
        children: [
          Expanded(
            child: TextField(
              decoration: InputDecoration(
                icon: Image.asset(YBImageStyle.getImagePath('login_password')),
                hintText:'请输入密码',
                border: InputBorder.none,
                contentPadding: EdgeInsets.all(0),
              ),
              obscureText: true,
              controller: _editingController,
            ),
          ),
          Container(
            color: YBColor.homeBorderLineColor,
            height: 1,
          ),
        ],
      ),
    );
  }
}

